int restore_vcpu_context(int vcpu, vcpu_guest_context_t *ctxt);
#endif
+ extern void xencons_suspend(void);
+ extern void xencons_resume(void);
+
int err = 0;
BUG_ON(smp_processor_id() != 0);
smp_suspend();
#endif
+ xencons_suspend();
+
xenbus_suspend();
ctrl_if_suspend();
xenbus_resume();
+ xencons_resume();
+
#ifdef CONFIG_SMP
smp_resume();
#endif
if (!xen_start_info.console_evtchn)
return 0;
- err = bind_evtchn_to_irqhandler(
- xen_start_info.console_evtchn, handle_input,
- 0, "xencons", inring());
+ err = bind_evtchn_to_irqhandler(xen_start_info.console_evtchn,
+ handle_input, 0, "xencons", inring());
if (err) {
xprintk("XEN console request irq failed %i\n", err);
- unbind_evtchn_from_irq(xen_start_info.console_evtchn);
return err;
}
return 0;
}
-void xencons_suspend_comms(void)
+void xencons_suspend(void)
{
if (!xen_start_info.console_evtchn)
unbind_evtchn_from_irqhandler(xen_start_info.console_evtchn, inring());
}
+void xencons_resume(void)
+{
+
+ (void)xencons_ring_init();
+}
}
int xc_linux_restore(int xc_handle, int io_fd, u32 dom, unsigned long nr_pfns,
- unsigned int store_evtchn, unsigned long *store_mfn)
+ unsigned int store_evtchn, unsigned long *store_mfn,
+ unsigned int console_evtchn, unsigned long *console_mfn)
{
dom0_op_t op;
int rc = 1, i, n, k;
*store_mfn = p_srec->resume_info.store_mfn =
pfn_to_mfn_table[p_srec->resume_info.store_mfn];
p_srec->resume_info.store_evtchn = store_evtchn;
+ *console_mfn = p_srec->resume_info.console_mfn =
+ pfn_to_mfn_table[p_srec->resume_info.console_mfn];
+ p_srec->resume_info.console_evtchn = console_evtchn;
munmap(p_srec, PAGE_SIZE);
/* Uncanonicalise each GDT frame number. */
goto out;
}
+ /* Canonicalize console mfn. */
+ if ( !translate_mfn_to_pfn(&p_srec->resume_info.console_mfn) ) {
+ ERR("Console frame is not in range of pseudophys map");
+ goto out;
+ }
+
print_stats( xc_handle, dom, 0, &stats, 0 );
/* Now write out each data page, canonicalising page tables as we go... */
*/
int xc_linux_restore(int xc_handle, int io_fd, uint32_t dom,
unsigned long nr_pfns, unsigned int store_evtchn,
- unsigned long *store_mfn);
+ unsigned long *store_mfn, unsigned int console_evtchn,
+ unsigned long *console_mfn);
int xc_linux_build(int xc_handle,
uint32_t domid,
"not a valid guest state file: pfn count out of range")
if dominfo.store_channel:
- evtchn = dominfo.store_channel.port2
+ store_evtchn = dominfo.store_channel.port2
else:
- evtchn = 0
+ store_evtchn = 0
+
+ if dominfo.console_channel:
+ console_evtchn = dominfo.console_channel.port2
+ else:
+ console_evtchn = 0
cmd = [PATH_XC_RESTORE, str(xc.handle()), str(fd),
- str(dominfo.id), str(nr_pfns), str(evtchn)]
+ str(dominfo.id), str(nr_pfns),
+ str(store_evtchn), str(console_evtchn)]
log.info("[xc_restore] " + join(cmd))
child = xPopen3(cmd, True, -1, [fd, xc.handle()])
child.tochild.close()
if fd == child.fromchild.fileno():
l = child.fromchild.readline()
while l:
+ log.info(l.rstrip())
m = re.match(r"^(store-mfn) (\d+)\n$", l)
if m:
if dominfo.store_channel:
dominfo.store_mfn,
dominfo.store_channel)
dominfo.exportToDB(save=True, sync=True)
- log.info(l.rstrip())
+ m = re.match(r"^(console-mfn) (\d+)\n$", l)
+ if m:
+ dominfo.console_mfn = int(m.group(2))
+ dominfo.exportToDB(save=True, sync=True)
+ dominfo.publish_console()
try:
l = child.fromchild.readline()
except:
self.configure_restart()
self.construct_image()
self.configure()
+ self.publish_console()
self.exportToDB(save=True)
except Exception, ex:
# Catch errors, cleanup and re-raise.
self.configure_fields()
self.create_devices()
self.create_blkif()
- self.publish_console()
def create_blkif(self):
"""Create the block device interface (blkif) for the vm.
int
main(int argc, char **argv)
{
- unsigned int xc_fd, io_fd, domid, nr_pfns, evtchn;
+ unsigned int xc_fd, io_fd, domid, nr_pfns, store_evtchn, console_evtchn;
int ret;
- unsigned long mfn;
+ unsigned long store_mfn, console_mfn;
- if (argc != 6)
- errx(1, "usage: %s xcfd iofd domid nr_pfns evtchn", argv[0]);
+ if (argc != 7)
+ errx(1,
+ "usage: %s xcfd iofd domid nr_pfns store_evtchn console_evtchn",
+ argv[0]);
xc_fd = atoi(argv[1]);
io_fd = atoi(argv[2]);
domid = atoi(argv[3]);
nr_pfns = atoi(argv[4]);
- evtchn = atoi(argv[5]);
+ store_evtchn = atoi(argv[5]);
+ console_evtchn = atoi(argv[6]);
- ret = xc_linux_restore(xc_fd, io_fd, domid, nr_pfns, evtchn, &mfn);
+ ret = xc_linux_restore(xc_fd, io_fd, domid, nr_pfns, store_evtchn,
+ &store_mfn, console_evtchn, &console_mfn);
if (ret == 0) {
- printf("store-mfn %li\n", mfn);
+ printf("store-mfn %li\n", store_mfn);
+ printf("console-mfn %li\n", console_mfn);
fflush(stdout);
}
return ret;